package com.demo.web.modules.uiv;

import com.demo.common.constant.api.base.IDEntity;
import com.demo.common.constant.api.UivCatalogAPIConstant;
import com.demo.common.result.ResponseInfo;
import com.demo.common.result.ResultVo;
import com.demo.service.uiv.UivCatalogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/uiv/catalog")
public class UivCatalogController {
    @Autowired
    private UivCatalogService cataService;

    @GetMapping("/test")
    public String test(){
        return "hello, you are in uivCatalog test!";
    }

    //******************************************************************
    // 字典分类表
    //******************************************************************
    //查询分辨率
    @RequestMapping(value = UivCatalogAPIConstant.RESOLUTION_TYPE_API, method = RequestMethod.POST)
    public ResultVo getResolutionTypeCatalogList(){
        return ResponseInfo.<Object>success(cataService.getResolutionTypeCatalogList());
    }

    //查询颜色类型列表
    @RequestMapping(value = UivCatalogAPIConstant.COLOR_TYPE_API, method = RequestMethod.POST)
    public ResultVo getColorTypeCatalogList(){
        return ResponseInfo.<Object>success(cataService.getColorTypeCatalogList());
    }

    //查询线型类型列表
    @RequestMapping(value = UivCatalogAPIConstant.LINE_TYPE_API, method = RequestMethod.POST)
    public ResultVo getLineStyleTypeCatalogList(){
        return ResponseInfo.<Object>success(cataService.getLineStyleTypeCatalogList());
    }

    //查询字体列表
    @RequestMapping(value = UivCatalogAPIConstant.FONT_TYPE_API, method = RequestMethod.POST)
    public ResultVo getFontFamilyTypeCatalogList(){
        return ResponseInfo.<Object>success(cataService.getFontFamilyTypeCatalogList());
    }

    //查询字体粗细列表
    @RequestMapping(value = UivCatalogAPIConstant.FONT_WEIGHT_TYPE_API, method = RequestMethod.POST)
    public ResultVo getFontWeightTypeCatalogList(){
        return ResponseInfo.<Object>success(cataService.getFontWeightTypeCatalogList());
    }

    //查询加密类型列表
    @RequestMapping(value = UivCatalogAPIConstant.ENCRYPTION_TYPE_API, method = RequestMethod.POST)
    public ResultVo getEncryptionTypeCatalogList(){
        return ResponseInfo.<Object>success(cataService.getEncryptionTypeCatalogList());
    }

    //查询通信协议列表
    @RequestMapping(value = UivCatalogAPIConstant.PROTOCOL_TYPE_API, method = RequestMethod.POST)
    public ResultVo getProtocolTypeCatalogList(){
        return ResponseInfo.<Object>success(cataService.getProtocolTypeCatalogList());
    }

    //查询变量公式列表
    @RequestMapping(value = UivCatalogAPIConstant.FORMULA_TYPE_API, method = RequestMethod.POST)
    public ResultVo getFormulaTypeCatalogList() {
        return ResponseInfo.<Object>success(cataService.getFormulaTypeCatalogList());
    }

    //查询属性数据类型列表
    @RequestMapping(value = UivCatalogAPIConstant.PROPS_DATA_TYPE_API, method = RequestMethod.POST)
    public ResultVo getPropsDataTypeCatalogList() {
        return ResponseInfo.<Object>success(cataService.getPropsDataTypeCatalogList());
    }

    //查询属性表单类型列表
    @RequestMapping(value = UivCatalogAPIConstant.PROPS_FORM_TYPE_API, method = RequestMethod.POST)
    public ResultVo getPropsFormTypeCatalogList() {
        return ResponseInfo.<Object>success(cataService.getPropsFormTypeCatalogList());
    }



    //查询操作权限列表
    @RequestMapping(value = UivCatalogAPIConstant.OPERATION_TYPE_API, method = RequestMethod.POST)
    public ResultVo getOperationTypeCatalogList() {
        return ResponseInfo.<Object>success(cataService.getOperationTypeCatalogList());
    }

    //查询图形类型
    @RequestMapping(value = UivCatalogAPIConstant.GRAPH_TYPE_API, method = RequestMethod.POST)
    public ResultVo getGraphTypeCatalogList() {
        return ResponseInfo.<Object>success(cataService.getGraphTypeCatalogList());
    }

    //查询行业类型
    @RequestMapping(value = UivCatalogAPIConstant.FIELD_TYPE_API, method = RequestMethod.POST)
    public ResultVo getFieldTypeCatalogList() {
        return ResponseInfo.<Object>success(cataService.getFieldTypeCatalogList());
    }

    //查询图元分类列表
    @RequestMapping(value = UivCatalogAPIConstant.TUPLE_TYPE_API, method = RequestMethod.POST)
    public ResultVo getTupleTypeCatalogList() {
        return ResponseInfo.<Object>success(cataService.getTupleTypeCatalogList());
    }

    //查询事件分类列表
    @RequestMapping(value = UivCatalogAPIConstant.EVENT_TYPE_API, method = RequestMethod.POST)
    public ResultVo getEventTypeCatalogList() {
        return ResponseInfo.<Object>success(cataService.getEventTypeCatalogList());
    }

    //查询事件行为分类列表
    @RequestMapping(value = UivCatalogAPIConstant.EVENT_OPERATION_TYPE_API, method = RequestMethod.POST)
    public ResultVo getEventOperationTypeCatalogList() {
        return ResponseInfo.<Object>success(cataService.getEventOperationTypeCatalogList());
    }

    //查询关系运算符分类列表
    @RequestMapping(value = UivCatalogAPIConstant.COMPARE_OPERATOR_TYPE_API, method = RequestMethod.POST)
    public ResultVo getOperatorTypeCatalogList() {
        return ResponseInfo.<Object>success(cataService.getOperatorTypeCatalogList());
    }

    //查询推送信息分类列表
    @RequestMapping(value = UivCatalogAPIConstant.NOTIFY_MSG_TYPE_API, method = RequestMethod.POST)
    public ResultVo getNotifyMsgTypeCatalogList() {
        return ResponseInfo.<Object>success(cataService.getNotifyMsgTypeCatalogList());
    }

    //查询动效分类列表
    @RequestMapping(value = UivCatalogAPIConstant.MOTION_TYPE_API, method = RequestMethod.POST)
    public ResultVo getMotionTypeCatalogList() {
        return ResponseInfo.<Object>success(cataService.getMotionTypeCatalogList());
    }

    //查询报警分类列表
    @RequestMapping(value = UivCatalogAPIConstant.ALARM_TYPE_API, method = RequestMethod.POST)
    public ResultVo getAlarmTypeCatalogList() {
        return ResponseInfo.<Object>success(cataService.getAlarmTypeCatalogList());
    }

    //查询报警处理分类列表
    @RequestMapping(value = UivCatalogAPIConstant.ALARM_DISPOSE_TYPE_API, method = RequestMethod.POST)
    public ResultVo getAlarmDisposeTypeCatalogList() {
        return ResponseInfo.<Object>success(cataService.getAlarmDisposeTypeCatalogList());
    }

    //******************************************************************
    // 普通表
    //******************************************************************
    //查询项目列表
    @RequestMapping(value = UivCatalogAPIConstant.PROJECT_API, method = RequestMethod.POST)
    public ResultVo getProjectCatalogList(){
        return ResponseInfo.<Object>success(cataService.getProjectCatalogList());
    }

    //查询页面列表
    @RequestMapping(value = UivCatalogAPIConstant.PAGE_API, method = RequestMethod.POST)
    public ResultVo getPageCatalogList(){
        return ResponseInfo.<Object>success(cataService.getPageCatalogList());
    }

    //查询设备列表
    @RequestMapping(value = UivCatalogAPIConstant.DEVICE_API, method = RequestMethod.POST)
    public ResultVo getDeviceCatalogList(){
        return ResponseInfo.<Object>success(cataService.getDeviceCatalogList());
    }

    //查询变量列表
    @RequestMapping(value = UivCatalogAPIConstant.VARIABLE_API, method = RequestMethod.POST)
    public ResultVo getVariableCatalogList(){
        return ResponseInfo.<Object>success(cataService.getVariableCatalogList());
    }

    //查询图元列表
    @RequestMapping(value = UivCatalogAPIConstant.TUPLE_SEARCH_API, method = RequestMethod.POST)
    public ResultVo getTupleCatalogListByTypeId(@RequestBody IDEntity<Long> idt){
        Long id = idt.getId();
        return ResponseInfo.<Object>success(cataService.getTupleCatalogListByTypeId(id));
    }

}
